package com.baizhi.controller;

import com.baizhi.entity.CmfzAlbum;
import com.baizhi.service.CmfzAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by Administrator on 2019/4/9 0009.
 */
@Controller
@RequestMapping("/album")
public class CmfzAlbumController {
    @Autowired
    private CmfzAlbumService cmfzAlbumService;

    @RequestMapping("/showAll")
    public @ResponseBody Map showAll(Integer page,Integer rows){
        Map map = cmfzAlbumService.showAll(page, rows);
        return map;
    }

    @RequestMapping("/add")
    public @ResponseBody Map add(MultipartFile picture, CmfzAlbum cmfzAlbum, HttpServletRequest request){
        Map add = cmfzAlbumService.add(picture, cmfzAlbum, request);
        return add;
    }

    @RequestMapping("/update")
    public @ResponseBody Map update(MultipartFile picture, CmfzAlbum cmfzAlbum, HttpServletRequest request){
        Map update = cmfzAlbumService.update(picture, cmfzAlbum, request);
        return update;
    }
}
